package net.zjitc.dao;

import net.zjitc.Utils.C3P0Utils;
import net.zjitc.domain.User;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import java.sql.SQLException;

/**
 * Created by Administrator on 2017/9/29.
 */
public class UserDaoInmpl implements UserDao{
    @Override
    public User findAll() throws SQLException {
        QueryRunner runner=new QueryRunner(C3P0Utils.getDataSourse());
        String sql="select * from user";
        User user=(User) runner.query(sql,new BeanHandler(User.class));
        return user;
    }
}
